package org.syyo.admin.controller.system;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.syyo.admin.anno.CheckPermissions;
import org.syyo.admin.domain.ResultVo;
import org.syyo.admin.service.FileService;

/**
 * @Auther: wangzhong
 * @Date: 2019/10/21 16:12
 * @Description:
 */
@RestController
@RequestMapping("/file")
public class FileController {


    @Autowired
    private FileService fileService;

    /**
     * 单个上传
     * @param file
     */
    @CheckPermissions("system:file:upload")
    @PostMapping("/upload")
    public ResultVo upload(@RequestParam("file")MultipartFile file) {
        return fileService.uploadFile(file);
    }
}
